<template>
  <div :class="['ab_tp_wp', { 'ab_tp_wp_official': type == 12,'m-no-select':type != 8}]">
    <div :class="['ab_tp_title',{'ab_tp_title1':(type == 2 || type == 1 || type==3 || type==5)}, { ab_tp_wp_official_title: type == 12 }]">
      <img v-if="type != 15" draggable="false" :src="headType.url[type]" />
      <div v-if="type==11" class="ab_tp_title_article">
        <div @click.stop.prevent="changeEditor">{{headType.title[type]}}</div>
        <div v-if="article_editor_show">>></div>
        <div v-if="article_editor_show">{{'文章编辑'}}</div>
      </div>
      <div v-else-if="type == 15" class="assect_title_search">
        <img @click="goback" style="margin-top:2px;vertical-align: middle" src="static/image/newWork/arrow-left.png" alt="">
        <span>
          {{assectName}}
        </span>
        <!-- <div class="newSearch" @click="showSearchWindow">
          <img src="static/image/newWork/search.png" alt="">
          搜索
        </div> -->
      </div>
      <div v-else>{{type==5?(myInfo.department||'我的部门'):(type==11&&article_editor_show)?'我的部门':headType.title[type]}}</div>
    </div>
    <div class="ab_tp_list_w">
      <slot :assectName='assectName'></slot>
    </div>
  </div>
</template>
<script>
import { mapState } from "vuex";
// type:0 广播 1:常用联系人 2：我的群组 3：组织架构
export default {
  props: {
    assectName: {
      default: "",
    },
    type: {
      type: Number,
      default: 1,
    },
    article_editor_show: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      headType: {
        url: [
          "static/image/word/app_broadcast.png",
          "static/image/home/contact/favorite_contacts.png",
          "static/image/home/contact/myGroup.png",
          "static/image/home/contact/structure.png",
          "static/image/word/app_file.png",
          "static/image/home/contact/contacts_department_icon.png",
          "static/image/word/app_share.png",
          "static/image/home/contact/system_icon.png",
          "static/image/word/app_collection.png",
          "static/image/word/app_dealt_with.png",
          "static/image/word/app_date.png",
          "static/image/word/app_article.png",
          "static/image/home/contact/official.png",
          "static/image/home/contact/official.png", //zk129新增，待替换
        ],
        title: [
          "广播消息",
          "常用联系人",
          "我的群组",
          "组织架构",
          "收发文件",
          "我的部门",
          "共享文件",
          "系统消息",
          "我的收藏",
          "我的待办",
          "我的日程",
          "我的文章",
          "公文管理",
          "无人值守", //zk129新增
        ],
      },
    };
  },
  watch: {},
  computed: {
    ...mapState(["myInfo"]),
  },
  mounted() {},
  methods: {
    showSearchWindow() {
      this.$emit("showSearchWindow");
    },
    goback() {
      this.$emit("assectGoback", "1");
    },
    changeEditor() {
      this.$emit("changeEditor", false);
    },
  },
  components: {},
  created() {},
};
</script>

<style lang="less">
.assect_title_search {
  display: flex;
  align-items: center;
  width: 100%;
  .newSearch {
    border: 1px solid #dcdfe6;
    width: 280px;
    height: 32px;
    font-size: 13px !important;
    margin: 0 auto;
    color: #c0c4cc;
    display: flex;
    align-items: center;
    padding: 0 10px;
    cursor: pointer;

    img {
      margin-right: 5px;
    }
  }
}
</style>
